package unq.edu.cui.tp.arena;



import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.windows.SimpleWindow;
import org.uqbar.arena.windows.WindowOwner;
import org.uqbar.arena.widgets.Button;

import unq.edu.cui.tp.dominio.Sistema;
import unq.edu.cui.tp.modelo.ventanas.GestionarEmpleados;
import unq.edu.cui.tp.modelo.ventanas.PlanificarSemana;
import unq.edu.cui.tp.modelo.ventanas.RestriccionesDeEmpleados;

public class PrincipalWindow extends SimpleWindow<Sistema> {

	public Sistema sistema;

	public PrincipalWindow(WindowOwner parent, Sistema model) {
		super(parent, model);
		this.getModelObject().inicializar();
	}


	@Override
	protected void createFormPanel(Panel mainPanel) {
		this.setTitle("Acciones del istema");

	}
	
	@Override
	protected void addActions(Panel actionsPanel) {
		new Button(actionsPanel).setCaption("Gestionar Empleados").onClick(new MessageSend(this, "abrirGestionDeEmpleados"));
		new Button(actionsPanel).setCaption("Ver restricciones de empleados").onClick(new MessageSend(this, "abrirGestionDeRestricciones"));
		new Button(actionsPanel).setCaption("Planificar la semana").onClick(new MessageSend(this, "abrirPlanificacion"));

	}
	
	
	
	/*******************************************************/
	/***************Acciones de los botones*****************/
	/*******************************************************/
	public void abrirGestionDeEmpleados(){
		new EmpleadosWindow(this, new GestionarEmpleados(this.getModelObject())).open();
	}
	
	public void abrirPlanificacion(){
		new PlanificarSemanaWindow(this, new PlanificarSemana(this.getModelObject())).open();	
	}
	
	public void abrirGestionDeRestricciones(){
		new RestriccionesDeEmpleadosWindow(this, new RestriccionesDeEmpleados(this.getModelObject())).open();
	}

}
